package com.sts.dao;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Repository;

import com.sts.bean.Car_run;

@Repository
public class Run_carDao implements IRun_car {

	@Resource
	private SqlSessionFactory sqlSessionFactory;
	
	Logger log = Logger.getLogger(this.getClass());
	
	@Override
	public int insertCar_run(Car_run carrun) {
		log.debug("Run_car dao in");
		log.debug(this.getClass());
		int result = 0;
		SqlSession session = sqlSessionFactory.openSession();
		IRun_car icarrun = session.getMapper(IRun_car.class);
		result = icarrun.insertCar_run(carrun) ;
		log.debug("Run_car dao out");
		return result;
	}

	@Override
	public List<Car_run> selectCar_run(Map<String, Object> map) {
		log.debug("selectCar_run dao in");
		log.debug(this.getClass());
		List<Car_run> list = new ArrayList<Car_run>() ;
		SqlSession session = sqlSessionFactory.openSession();
		IRun_car icarrun = session.getMapper(IRun_car.class);
		list = icarrun.selectCar_run(map) ;
		log.debug("selectCar_run dao out");
		return list;
	}

	@Override
	public int selectSize(Map<String, Object> map) {
		log.debug("car_run selectSize dao in");
		log.debug(this.getClass());
		int result = 0;
		SqlSession session = sqlSessionFactory.openSession();
		IRun_car icarrun = session.getMapper(IRun_car.class);
		result = icarrun.selectSize(map) ;
		log.debug("car_run selectSize dao out");
		return result;
	}

}
